way to always call a function without repeating code inside a function with guard clauses